home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple WWDC 1996
/
WWDC96_1996 (CD).toast
/
Technology Materials
/
MacOS 8 Resources
/
Developer Tools
/
Mac OS 8 Interfaces & Libraries
/
Interfaces
/
CIncludes
/
OpenTptLinks.h
< prev
next >
Wrap
C/C++ Source or Header
|
1996-05-01
|
6KB
|
240 lines
/*
File: OpenTptLinks.h
Contains: Definitions for link modules
Copyright: © 1994-1996 by Apple Computer, Inc., all rights reserved.
*/
#ifndef __OPENTPTLINKS__
#define __OPENTPTLINKS__
#ifndef __OPENTRANSPORT__
#include <OpenTransport.h>
#endif
/*******************************************************************************
** Device Types for OTPortRefs
********************************************************************************/
#define kPortBaseResID 1000
enum
{
kOTADEVDevice = 1, /* An Atalk ADEV */
kOTMDEVDevice = 2, /* A TCP/IP MDEV */
kOTLocalTalkDevice = 3, /* LocalTalk */
kOTIRTalkDevice = 4, /* IRTalk */
kOTTokenRingDevice = 5, /* Token Ring */
kOTISDNDevice = 6, /* ISDN */
kOTATMDevice = 7, /* ATM */
kOTSMDSDevice = 8, /* SMDS */
kOTSerialDevice = 9, /* Serial */
kOTEthernetDevice = 10, /* Ethernet */
kOTSLIPDevice = 11, /* SLIP Pseudo-device */
kOTPPPDevice = 12, /* PPP Pseudo-device */
kOTModemDevice = 13, /* Modem Pseudo-Device */
kOTFastEthernetDevice = 14, /* 100 MB Ethernet */
kOTFDDIDevice = 15, /* FDDI */
kOTATMLANEDevice = 16, /* ATM LAN emulation */
kOTATMSNAPDevice = 17 /* ATM SNAP emulation */
};
/*******************************************************************************
** Interface option flags
********************************************************************************/
enum
{
//
// Ethernet framing options
//
kOTFramingEthernet = 0x01,
kOTFramingEthernetIPX = 0x02,
kOTFraming8023 = 0x04,
kOTFraming8022 = 0x08
};
enum
{
//
// RawMode options
//
kOTRawRcvOn = 0,
kOTRawRcvOff = 1,
kOTRawRcvOnWithTimeStamp = 2
};
enum
{
//
// OPT_SETPROMISCUOUS value
//
DL_PROMISC_OFF = 0
};
/*******************************************************************************
** Module definitions
********************************************************************************/
//
// XTI Levels
//
enum
{
LNK_ENET = 'ENET',
LNK_TOKN = 'TOKN',
LNK_FDDI = 'FDDI',
LNK_TPI = 'LTPI'
};
//
// Module IDs
//
enum
{
kT8022ModuleID = 7100,
kEnetModuleID = 7101,
kTokenRingModuleID = 7102,
kFDDIModuleID = 7103
};
//
// Module Names
//
#define kEnet8022Name "enet8022x"
#define kEnetName "enet"
#define kFastEnetName "fenet"
#define kTokenRingName "tokn"
#define kFDDIName "fddi"
#define kIRTalkName "irtlk"
#define kSMDSName "smds"
#define kATMName "atm"
#define kT8022Name "tpi8022x"
#define kATMLANEName "atmlane"
#define kATMSNAPName "atmsnap"
//
// Address Family
//
enum
{
AF_8022 = 8200 // Our 802.2 generic address family
};
/*******************************************************************************
** Options
********************************************************************************/
enum
{
OPT_ADDMCAST = 0x1000,
OPT_DELMCAST = 0x1001,
OPT_RCVPACKETTYPE = 0x1002,
OPT_RCVDESTADDR = 0x1003,
OPT_SETRAWMODE = 0x1004,
OPT_SETPROMISCUOUS = 0x1005
};
enum OTPacketType
{
kETypeStandard=0,
kETypeMulticast,
kETypeBroadcast,
kETRawPacketBit = 0x80000000,
kETTimeStampBit = 0x40000000
};
/*******************************************************************************
** Link related constants
********************************************************************************/
enum
{
//
// length of an ENET hardware addressaddress
//
kMulticastLength = 6,
k48BitAddrLength = 6,
//
// The protocol type is our DLSAP
//
k8022DLSAPLength = 2,
//
k8022SNAPLength = 5,
//
// length of an address field used by the ENET enpoint
// = k48BitAddrLength + sizeof(protocol type)
//
kEnetAddressLength = k48BitAddrLength + k8022DLSAPLength,
//
// Special DLSAPS for ENET
//
kSNAPSAP = 0x00AA,
kIPXSAP = 0x00FF,
kMax8022SAP = 0x00FE,
k8022GlobalSAP = 0x00FF,
kMinDIXSAP = 1501,
kMaxDIXSAP = 0xFFFFU
};
/*******************************************************************************
** Generic Address Structure
********************************************************************************/
struct T8022Address
{
OTAddressType fAddrFamily;
UInt8 fHWAddr[k48BitAddrLength];
UInt16 fSAP;
UInt8 fSNAP[k8022SNAPLength];
};
enum
{
k8022BasicAddressLength = sizeof(OTAddressType) + k48BitAddrLength +
sizeof(UInt16),
k8022SNAPAddressLength = sizeof(OTAddressType) + k48BitAddrLength +
sizeof(UInt16) + k8022SNAPLength
};
/*******************************************************************************
** Some helpful stuff for dealing with 48 bit addresses
********************************************************************************/
#define OTCompare48BitAddresses(p1, p2) \
(*(const UInt32*)((const UInt8*)(p1)) == *(const UInt32*)((const UInt8*)(p2)) && \
*(const UInt16*)(((const UInt8*)(p1))+4) == *(const UInt16*)(((const UInt8*)(p2))+4) )
#define OTCopy48BitAddress(p1, p2) \
(*(UInt32*)((UInt8*)(p2)) = *(const UInt32*)((const UInt8*)(p1)), \
*(UInt16*)(((UInt8*)(p2))+4) = *(const UInt16*)(((const UInt8*)(p1))+4) )
#define OTClear48BitAddress(p1) \
(*(UInt32*)((UInt8*)(p1)) = 0, \
*(UInt16*)(((UInt8*)(p1))+4) = 0 )
#define OTCompare8022SNAP(p1, p2) \
(*(const UInt32*)((const UInt8*)(p1)) == *(const UInt32*)((const UInt8*)(p2)) && \
*(((const UInt8*)(p1))+4) == *(((const UInt8*)(p2))+4) )
#define OTCopy8022SNAP(p1, p2) \
(*(UInt32*)((UInt8*)(p2)) = *(const UInt32*)((const UInt8*)(p1)), \
*(((UInt8*)(p2))+4) = *(((const UInt8*)(p1))+4) )
#define OTIs48BitBroadcastAddress(p1) \
(*(UInt32*)((UInt8*)(p1)) == 0xffffffff && \
*(UInt16*)(((UInt8*)(p1))+4) == 0xffff )
#define OTSet48BitBroadcastAddress(p1) \
(*(UInt32*)((UInt8*)(p1)) = 0xffffffff, \
*(UInt16*)(((UInt8*)(p1))+4) = 0xffff )
#define OTIs48BitZeroAddress(p1) \
(*(UInt32*)((UInt8*)(p1)) == 0 && \
*(UInt16*)(((UInt8*)(p1))+4) == 0 )
#endif